home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kdepim / exchangeclient.h < prev   
Encoding:
C/C++ Source or Header  |  2005-09-10  |  4.6 KB  |  135 lines

  1. /*
  2.     This file is part of libkpimexchange
  3.     Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
  4.  
  5.     This library is free software; you can redistribute it and/or
  6.     modify it under the terms of the GNU Library General Public
  7.     License as published by the Free Software Foundation; either
  8.     version 2 of the License, or (at your option) any later version.
  9.  
  10.     This library is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.     Library General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU Library General Public License
  16.     along with this library; see the file COPYING.LIB.  If not, write to
  17.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18.     Boston, MA 02110-1301, USA.
  19. */
  20. #ifndef KDEPIM_EXCHANGE_CLIENT_H
  21. #define KDEPIM_EXCHANGE_CLIENT_H
  22.  
  23. #include <qstring.h>
  24. #include <qdatetime.h>
  25. #include <qobject.h>
  26. #include <qhostaddress.h>
  27. #include <qptrlist.h>
  28.  
  29. #include <kdepimmacros.h>
  30.  
  31. namespace KCal { 
  32.   class Event;
  33.   class Calendar;
  34. }
  35.  
  36. namespace KIO { 
  37.   class Job; 
  38. }
  39.  
  40. namespace KPIM {
  41.  
  42. class ExchangeAccount;
  43. class ExchangeDownload;
  44. class ExchangeUpload;
  45. class ExchangeDelete;
  46. //class ExchangeMonitor;
  47.  
  48. class KDE_EXPORT ExchangeClient : public QObject {
  49.     Q_OBJECT
  50.   public:
  51.     ExchangeClient( ExchangeAccount* account, const QString& mTimeZoneId=QString::null );
  52.     ~ExchangeClient();
  53.  
  54.     /**
  55.      * Associate this client with a window given by @p window.
  56.      */
  57.     void setWindow(QWidget *window);
  58.  
  59.     /**
  60.      * Returns the window this client is associated with.
  61.      */
  62.     QWidget *window() const;
  63.  
  64.     /**
  65.      * Set the time zone to use 
  66.      */
  67.     void setTimeZoneId( const QString& timeZoneId );
  68.     QString timeZoneId();
  69.         
  70.     // synchronous functions
  71.     enum { 
  72.       ResultOK,  /** No problem */
  73.       UnknownError, /** Something else happened */
  74.       CommunicationError, /** IO Error, the server could not be reached or returned an HTTP error */
  75.       ServerResponseError,  /** Server did not give a useful response. For download, this
  76.                                 means that a SEARCH did not result in anything like an appointment */
  77.       IllegalAppointmentError, /** Reading appointment data from server response failed */
  78.       NonEventError, /** The Incidence that is to be uplaoded to the server is not an Event */
  79.       EventWriteError, /** When writing an event to the server, an error occurred */
  80.       DeleteUnknownEventError /** The event to be deleted does not exist on the server */
  81.     };
  82.  
  83.     int downloadSynchronous( KCal::Calendar* calendar, const QDate& start, const QDate& end, bool showProgress=false);
  84.     int uploadSynchronous( KCal::Event* event );
  85.     int removeSynchronous( KCal::Event* event );
  86.  
  87.     // ExchangeMonitor* monitor( int pollMode, const QHostAddress& ownInterface );
  88.  
  89.     QString detailedErrorString();
  90.  
  91.   public slots:
  92.     // Asynchronous functions, wait for "finished" signals for result
  93.     // Deprecated: use download() without the Calendar* argument instead
  94.     void download( KCal::Calendar* calendar, const QDate& start, const QDate& end, bool showProgress=false);
  95.     void download( const QDate& start, const QDate& end, bool showProgress=false);
  96.     void upload( KCal::Event* event );
  97.     void remove( KCal::Event* event );
  98.     void test();
  99.  
  100.   private slots:
  101.     void slotDownloadFinished( ExchangeDownload* worker, int result, const QString& moreInfo );
  102.     void slotDownloadFinished( ExchangeDownload* worker, int result, const QString& moreInfo, QPtrList<KCal::Event>& );
  103.     void slotUploadFinished( ExchangeUpload* worker, int result, const QString& moreInfo );
  104.     void slotRemoveFinished( ExchangeDelete* worker, int result, const QString& moreInfo );
  105.     void slotSyncFinished( int result, const QString& moreInfo );
  106.  
  107.   signals:
  108.     // Useful for progress dialogs, shows how much still needs to be done.
  109.     // Not used right now, since ExchangeDownload provides its own progress dialog
  110.     void startDownload();
  111.     void finishDownload();
  112.  
  113.     void downloadFinished( int result, const QString& moreInfo );
  114.     void event( KCal::Event* event, const KURL& url);
  115.     void downloadFinished( int result, const QString& moreInfo, QPtrList<KCal::Event>& events );
  116.     void uploadFinished( int result, const QString& moreInfo );
  117.     void removeFinished( int result, const QString& moreInfo );
  118.  
  119.   private:
  120.     void test2();
  121.  
  122.     enum { WaitingForResult, HaveResult, Error };
  123.    
  124.     int mClientState;
  125.     int mSyncResult;
  126.     QString mDetailedErrorString;
  127.     QWidget* mWindow;
  128.     ExchangeAccount* mAccount;
  129.     QString mTimeZoneId;
  130. };
  131.  
  132. }
  133.  
  134. #endif
  135.